package com.lagou.SystemView;

import com.lagou.QuestionsSystem.QuzManageSysView;
import com.lagou.StudentsManageSystem.StuManageView;
import com.lagou.client.ClientInitClose;
import com.lagou.client.ClientScanner;

import java.io.BufferedWriter;
import java.io.IOException;

/**
 * 编程实现管理员系统界面的绘制和功能实现
 */
public class ManagerView {
    /**
     * 合成复用原则
     */
    private static ClientInitClose cic;

    /**
     * 通过构造方法实现成员变量的初始化
     */
    public ManagerView(ClientInitClose cic){
        this.cic = cic;
    }
    //绘制管理员系统界面
    public void ManagerMainPage() throws IOException, ClassNotFoundException {

        while (true) {
            System.out.println("   \n\n          管理员系统");
            System.out.println("--------------------------------");
            System.out.print("   [1] 学员管理");
            System.out.println("   [2] 考题管理");
            System.out.println("   [0] 退出系统");
            System.out.println("--------------------------------");
            System.out.println("请选择要进行的业务编号");
            int choose = ClientScanner.getScanner().nextInt();
            switch (choose) {
                case 1:
                    //进入学员管理界面
                    cic.getPs().println("StudentsManage");
                    StuManageView smv = new StuManageView(cic);
                    smv.manageMainPage();
                    break;
                case 2:
                    //进入考题管理界面
                    cic.getPs().println("QuestionManage");
                    QuzManageSysView qmv = new QuzManageSysView(cic);
                    qmv.manageMainPage();
                    break;
                case 0:
                    cic.getPs().println("exit");
                    System.out.println("正在退出系统");
                    return;
                default:
                    System.out.println("输入错误，请重新选择");
            }
        }
    }
}
